<?php
    $status_option = array(
        '3'=>'---'.__('admin_all_order').'---',
        '0'=>__('admin_failed'),//'Failed',
        '1'=>__('admin_PAID'),//'Paid',
        '2'=>__('admin_DELIVERED'),//'Delivered'
    );
    $selected_status = isset ($selected_status)?$selected_status:3;
?>
<script type="text/javascript">
    $(document).ready(function(){
        $("#status_cat").change(function(){
            window.location.href = "<?php echo base_url().'admin/invoices/listing/'?>"+$(this).val();
        });
    });
</script>
<div style="margin: 5px 0 10px;">
    <?php echo form_dropdown('selected_status', $status_option, $selected_status,'id="status_cat"')?>
</div>
<table style="width: 100%;">
            <tr>
                <th scope="col" class="first"><?php echo __('id'); ?></th>
                <th scope="col" ><?php echo __('email');?></th>
                <th scope="col" ><?php echo __('amount');?></th>
                <th scope="col" ><?php echo __('admin_invoice_orderdate');?></th>
                <th scope="col" ><?php echo __('admin_invoice_status');?></th>
                <th scope="col" ><?php echo __('admin_invoice_pdf_file');?></th>
                <th scope="col" class="last"><?php echo __('actions'); ?></th>
            </tr>
            <?php foreach ($invoices as $invoice):?>
            <tr class="hoverall">
                
                <?php
                    $status = '';
                    if($invoice['status']==0){
                        $status = __('admin_failed');//"FAILED";
                    }
                    if($invoice['status']==1){
                        $status = __('admin_PAID');//"PAID";
                    }
                    if($invoice['status']==2){
                        $status = __('admin_DELIVERED');//"DELIVERED";
                    }
                ?>
                <td><?php echo $invoice['id'];?></td>
                <td><?php echo $invoice['email'];?></td>
                <td><?php echo $invoice['amount'];?></td>
                <td><?php echo $invoice['invoice_date'];?></td>
                <td><?php echo $status;?></td>
                <td><a href="<?php echo base_url().'files/ticket/'.$invoice['pdf_file'].'.pdf';?>"><?php echo $invoice['pdf_file'].'.pdf'?></a></td>
                <td><a href="<?php echo base_url().'admin/invoices/invoice_details/'.$invoice['id'];?>"><?php echo __('admin_invoice_details')?></a></td>
            </tr>
            <?php endforeach;?>
            <tr>
                <td><?php echo $pagination;?></td>
            </tr>
</table>